﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace ERP.Migrations
{
    /// <inheritdoc />
    public partial class MaterialRequirementModel0623 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "DeviceType",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    DeviceCode = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
                    DeviceName = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
                    @int = table.Column<string>(name: "int", type: "character varying(30)", maxLength: 30, nullable: false),
                    Remark = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DeviceType", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Procedure",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    ProcedureCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    ProcedureName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    IsNo = table.Column<int>(type: "integer", nullable: true),
                    Context = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Procedure", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ProductionWasteOrder",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    WasteOrderCode = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
                    WasteOrderName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    ProductionWorkOrder = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
                    WasteDate = table.Column<DateTime>(type: "date", nullable: false),
                    OrderStatus = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
                    WarehouseName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    Creator = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
                    CreateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
                    UpdateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductionWasteOrder", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Workmanship",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    WorkmanshipCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    WorkmanshipName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    WorkmanshipDescribe = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    IsNo = table.Column<int>(type: "integer", nullable: true),
                    Context = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Workmanship", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Workshop",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    WorkshopCode = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    WorkshopName = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    WorkshopSize = table.Column<decimal>(type: "numeric", nullable: true),
                    WorkshopPerson = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
                    IsNo = table.Column<int>(type: "integer", nullable: true),
                    Context = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Workshop", x => x.Id);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "DeviceType");

            migrationBuilder.DropTable(
                name: "Procedure");

            migrationBuilder.DropTable(
                name: "ProductionWasteOrder");

            migrationBuilder.DropTable(
                name: "Workmanship");

            migrationBuilder.DropTable(
                name: "Workshop");
        }
    }
}
